﻿using System.Collections.Generic;

namespace FastestWays.Helpers.Voice
{
    public static class VoiceInstructions
    {
        public static Dictionary<string, VoiceString> RoutePhrases { get; set; }

        static VoiceInstructions()
        {
            RoutePhrases = new Dictionary<string, VoiceString>()
                {
                    {"NONE", new VoiceString(){Words = string.Empty}},
                    {"TURN_LEFT", new VoiceString(){Words = "Turn Left"}},
                    {"TURN_RIGHT", new VoiceString(){Words = "Turn Right"}},
                    {"APPROACHING_DESTINATION", new VoiceString(){Words = "You have reached your destination"}},
                    {"CONTINUE", new VoiceString(){Words = "Continue straight"}},
                    {"KEEP_LEFT", new VoiceString(){Words = "Keep left"}},
                    {"KEEP_RIGHT", new VoiceString(){Words = "Keep right"}},
                    {"ROUNDABOUT_ENTER", new VoiceString(){Words = "At the roundabout, take the {0} exit", NumberOfArgs = 1}},
                    {"ROUNDABOUT_EXIT", new VoiceString(){Words = "Take the {0} exit", NumberOfArgs = 1}},
                    {"ROUNDABOUT_STRAIGHT", new VoiceString(){Words = "At the roundabout, continue straight"}},
                    {"ROUNDABOUT_EXIT_STRAIGHT", new VoiceString(){Words = "Exit straight"}},
                    {"ROUNDABOUT_RIGHT", new VoiceString(){Words = "At the roundabout, turn right"}},
                    {"ROUNDABOUT_EXIT_RIGHT", new VoiceString(){Words = "Exit right"}},
                    {"ROUNDABOUT_LEFT", new VoiceString(){Words = "At the roundabout, turn left"}},
                    {"ROUNDABOUT_EXIT_LEFT", new VoiceString(){Words = "Exit left"}},
                    {"ROUNDABOUT_U", new VoiceString(){Words = "At the roundabout, take a u turn"}}
                };
        }

        public static string GetParsedInstructionFromDictionary(string key, object[] arg = null)
        {
            VoiceString instruction;
            if (RoutePhrases.TryGetValue(key, out instruction))
            {
                return instruction.GetFormattedVoiceString(arg);
            }
            return string.Empty;
        }

    }
}